/**
 * @param {number[]} nums
 * @return {boolean}
 */
var containsDuplicate = function(nums) {
  function quickSort(left, right, arr) {
    if(left >= right)
      return ;
    let i = left, j = right, base = arr[left];
    while(i < j) {
      while(i < j && arr[j] >= base) j--;
      while(i < j && arr[i] <= base) i++;
      if(i < j) {
        let temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
      }
    }
    arr[left] = arr[i];
    arr[i] = base;
    quickSort(left, i, arr);
    quickSort(j + 1, right, arr);
  }
  quickSort(0, nums.length - 1, nums);
  for(let i = 0; i < nums.length - 1; i++) {
    if(nums[i] === nums[i + 1]) {
      return true;
    }
  }
  return false;
};


let nums = [1,1,1,3,3,4,3,2,4,2];
console.log(containsDuplicate(nums));
nums = [1,2,3,1];
console.log(containsDuplicate(nums));
nums = [1,2,3];
console.log(containsDuplicate(nums));
